import React, { useState, useEffect } from "react";
import { useRoutes } from "react-router-dom";

import A from "./pages/A"
import B from "./pages/B"

import { refresh, routes } from "./routes"

export default function App() {
  const [route, setRoute] = useState(routes)
  const elements = useRoutes(route)

  useEffect(()=>{
    setTimeout(()=>{
      setRoute([{path:"/a", element:<A />}])
    }, 5000)
    setTimeout(()=>{
      setRoute([{path:"/b", element:<B />}])
    }, 15000)
  }, [])

  return (
    <>
      {elements}
    </>
  );
}
